package com.jt.controller;

import com.fasterxml.jackson.core.sym.Name2;
import jdk.nashorn.internal.objects.annotations.Property;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
//注解说明：@RestController = @ResponseBody  + @Controller
//效果：1.将当前类交给Spring容器管理
//     2.@Controller 将当前类交给Spring容器管理
//     3.@ResponseBody 前后端交互时，将后端服务器返回的对象转化为JSON
@RestController
@PropertySource(value = "classpath:/name.properties",encoding = "utf-8")
public class HelloController {

    @Value("${helloname}")
    private String name; // = "张三";

    @Value("${helloname2}")
    private String name2;

    private String name3 = "张三";

    @RequestMapping("/getName")
    public String getName(){
        return name + "|" + name2 + "|" + name3;
    }
}
